package com.nbsaas.boot.store.rest.resource;

import com.nbsaas.boot.store.api.apis.StoreImageApi;
import com.nbsaas.boot.store.data.entity.StoreImage;
import com.nbsaas.boot.store.api.domain.request.StoreImageRequest;
import com.nbsaas.boot.store.api.domain.response.StoreImageResponse;
import com.nbsaas.boot.store.api.domain.simple.StoreImageSimple;
import com.nbsaas.boot.store.rest.convert.StoreImageSimpleConvert;
import com.nbsaas.boot.store.rest.convert.StoreImageEntityConvert;
import com.nbsaas.boot.store.rest.convert.StoreImageResponseConvert;
import com.nbsaas.boot.store.data.repository.StoreImageRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   商家图片-业务接口实现
*/
@Transactional
@Service
public class StoreImageResource extends BaseResource<StoreImage,StoreImageResponse, StoreImageSimple, StoreImageRequest>  implements StoreImageApi {

    @Resource
    private StoreImageRepository storeImageRepository;

    @Override
    public JpaRepositoryImplementation<StoreImage, Serializable> getJpaRepository() {
        return storeImageRepository;
    }

    @Override
    public Function<StoreImage, StoreImageSimple> getConvertSimple() {
        return new StoreImageSimpleConvert();
    }

    @Override
    public Function<StoreImageRequest, StoreImage> getConvertForm() {
        return new StoreImageEntityConvert();
    }

    @Override
    public Function<StoreImage, StoreImageResponse> getConvertResponse() {
        return new StoreImageResponseConvert();
    }




}


